//
//  WRYHotCommentView.m
//  BaiSiBuJie
//
//  Created by wry on 16/5/6.
//  Copyright © 2016年 WRY. All rights reserved.
//

#import "WRYHotCommentView.h"

@interface WRYHotCommentView ()
@property (weak, nonatomic) IBOutlet UIView *voiceCommentView;
@property (weak, nonatomic) IBOutlet UILabel *nameLable;
@property (weak, nonatomic) IBOutlet UIButton *voicePlayBtn;//播放按钮
@property (weak, nonatomic) IBOutlet UILabel *textComment;


@end

@implementation WRYHotCommentView

-(void)setItem:(WRYThemeItem *)item
{
    [super setItem:item];
    if (item.hotcommentItem.content.length) {//文字评论
        _voiceCommentView.hidden=YES;
        _textComment.hidden=NO;
        _textComment.text=item.hotcommentItem.totalContent;//评论内容
        
        
    }else{//语音评论
        _voiceCommentView.hidden=NO;
        _textComment.hidden=YES;
        
        _nameLable.text=item.hotcommentItem.user.username;//用户名
        NSString * time;
        if (item.hotcommentItem.voicetime>60) {
            NSInteger min= item.hotcommentItem.voicetime/60;
            NSInteger sec=item.hotcommentItem.voicetime%60;
            time=[NSString stringWithFormat:@"%02ld'%02ld""",min,sec];
        }else{
            time=[NSString stringWithFormat:@"%02ld""",item.hotcommentItem.voicetime];
        }
        
//        [_voicePlayBtn setTitle:time forState:(UIControlStateNormal)];
        _voicePlayBtn.titleLabel.text=time;//时长
    }
}

@end
